<%@ Page Language="C#" MasterPageFile="~/HermesPortal.master" AutoEventWireup="true" CodeFile="Realms.aspx.cs" Inherits="Saga_Realms" Title="Untitled Page" %>

<%@ Register Src="Controls/RealmsTreeView.ascx" TagName="RealmsTreeView" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="contentSection" Runat="Server">
 <asp:ObjectDataSource runat="server" ID="RealmDataSource" SelectMethod="GetRealms"  
        TypeName="HermesPortal.Core.RealmServices">
    </asp:ObjectDataSource>
     <asp:ObjectDataSource runat="server" ID="ObjectDataSource1" SelectMethod="GetRealms"  
        TypeName="HermesPortal.Core.RealmServices">
    </asp:ObjectDataSource>
    
    <asp:label runat="server" ID="lblChooseRealmView" Text="View Realms By:" AssociatedControlID="ddlGetRealmsView"  />
    <asp:DropDownList ID="ddlGetRealmsView" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChange_ddlGetRealmsView"   >
        <asp:ListItem Text="Top Level Realms Only" Value="1" />
        <asp:ListItem Text="All Realms For This Saga" Value="2" />
         <asp:ListItem Text="Realms Tree View" Value="3" />
    </asp:DropDownList>
    <asp:HyperLink ID="lnkAddNewRealm" runat="server" Text="add realm" visible="false" ></asp:HyperLink>  
    <asp:GridView runat="server" ID="RealmList" DataSourceID="RealmDataSource" AutoGenerateColumns="false" DataKeyNames="RealmId"  Width="100%" >
    <Columns>
    <asp:TemplateField>
      <ItemTemplate>
      <table>
        <tr>
            <td colspan="2">
            <asp:HyperLink runat="server" ID="lnkSagaTitle" Text='<%# Eval("Title") %>'  NavigateUrl='<%#String.Format("Realm.aspx?SagaID={0}&RealmID={1}", Eval("SagaID"), Eval("RealmID"))  %>' />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblSummary" runat="server" Text='<%# Eval("Summary") %>' />  
            </td>
        </tr>
        <tr>
            <td colspan="2">
            <div id="subNodeHeader">
                <asp:Label runat="server" ID="lblSubRealms" Text="Sub Realms:"  Visible="false"  />  
            </div>
            <br />
            <asp:DataList runat="server" ID="listSubNodes" RepeatDirection="Vertical" RepeatColumns="4"  Visible="false"    >
            <ItemTemplate>
                <asp:HyperLink Text='<%# Eval("value") %>'  runat="server" NavigateUrl='<%# String.Format(@"~/Realms/Realm.aspx?SagaID={0}&RealmID={1}",((PageBase)this.Page).SagaID,  Eval("key")) %>' />,&nbsp;    
            </ItemTemplate>
            </asp:DataList>
            </td>
        </tr>
      </table>
      </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    <uc1:RealmsTreeView ID="RealmsTreeView1" runat="server" Visible="false" />
   
</asp:Content>

